Reverse osmosis (RO) and nanofiltration (NF) membranes are often used to remove salt and other substances from seawater or brackish water. In this membrane-technology filtration method, pressure is applied to the feed solution of a selective membrane such that solvent passes to the low pressure side of the membrane while large molecules and ions are retained on the pressurized side of the membrane. Aromatic polyamide thin-film composite membranes, commonly used for RO and NF membranes, include a thin polyamide film formed on a mesoporous polymeric support via interfacial polymerization. Commercially available RO and NF membranes typically include defects or pores through which gas flow occurs via Knudsen diffusion, and are thus unsuitable for separation of helium or hydrogen from a gas mixture containing carbon dioxide in dry state.